using System;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	[Serializable()]
    [XmlType(TypeName = "StyleMapType")]
	public class StyleMap : StyleSelector
	{
        private SimpleGenericList<StyleMapPair> pairsField;

        public StyleMap()
		{
            this.pairsField = new SimpleGenericList<StyleMapPair>();
        }

        [XmlElement(ElementName = "Pair", Type = typeof(StyleMapPair))]
        public StyleMapPair[] PairArray
        {
            get { return this.pairsField.ToArray(); }
            set { this.pairsField = new SimpleGenericList<StyleMapPair>(value); }
        }

        [XmlIgnore()]
        public SimpleGenericList<StyleMapPair> Pairs
        {
            get { return this.pairsField; }
        }
    }

    [Serializable()]
    [XmlType(TypeName = "StyleMapPairType")]
    public class StyleMapPair : ObjectType
    {
        private StyleStateEnum stateEnumField;
        private string styleUrlField;

        public StyleMapPair()
        {
            this.stateEnumField = StyleStateEnum.Normal;
        }

        [XmlElement(ElementName = "styleUrl", DataType = "anyURI")]
        public string StyleUrl
        {
            get { return this.styleUrlField; }
            set { this.styleUrlField = value; }
        }

        [XmlElement(ElementName = "key", Type = typeof(StyleStateEnum))]
        public StyleStateEnum Key
        {
            get { return this.stateEnumField; }
            set { this.stateEnumField = value; }
        }
    }

    [Serializable()]
    [XmlType(TypeName = "styleStateEnum")]
    public enum StyleStateEnum
    {
        [XmlEnum(Name = "normal")]
        Normal,

        [XmlEnum(Name = "highlight")]
        Highlight
    }
}